<?php
	
	function logging($text){
		$file = "log.txt";
		file_put_contents($file, "\r\n".date("d F Y H:i").":\t", FILE_APPEND);
		file_put_contents($file, $text, FILE_APPEND);
	}
	
	function exit_with_response($errno, $errmsg = "", $json = ""){
		if ($json == null || trim($json) == "") $json = "{}";
		
		//header('Content-type: application/json');
		echo "{\"result_code\":\"$errno\", \"result_message\":\"$errmsg\", \"result_data\":$json}";
		exit;
	}
	
?>
